package base.exa16;

/**
 * 运行错误
 */
public class RunError {


    public int addOne(Integer a,Integer b) {
        Integer result = 0;
        try{
            result = a+b;
        }catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

    public int add(Integer a,Integer b){
        Integer result = null;
        try {
            result = a+b;
        }
        catch (Exception e){
            e.printStackTrace();
            System.out.println("运行中断");
            return -1;
        }
        return result;
    }

    public static void main(String[] args) {
        RunError logicError = new RunError();
        System.out.println("100+100= "+logicError.addOne(null,100));
        //System.out.println("100+100= "+logicError.add(null,100));
    }
}
